# -*- coding:utf-8 -*-
class Solution:
    def minNumberInRotateArray(self, rotateArray):
        # write code here
        if not len(rotateArray):
            return 0
        if len(rotateArray) == 1:
            return rotateArray[0]
        mid = len(rotateArray)//2
        left = 0
        right = len(rotateArray)-1
        #print(rotateArray[mid] < rotateArray[mid-1])
        while rotateArray[mid] > rotateArray[mid-1]:
            if rotateArray[mid] > rotateArray[right]:
                left = mid + 1
                mid = (right - left) // 2 + left
            elif rotateArray[mid] < rotateArray[right]:
                right = mid - 1
                mid = (right - left) //2 + left
            print('left value is {}, mid value is {}, right value is {}'.format(rotateArray[left], rotateArray[mid], rotateArray[right]))
        return rotateArray[mid]
test = Solution()
print(test.minNumberInRotateArray([6501,6828,6963,7036,7422,7674,8146,8468,8704,8717,9170,9359,9719,9895,9896,9913,9962,154,293,334,492,1323,1479,1539,1727,1870,1943,2383,2392,2996,3282,3812,3903,4465,4605,4665,4772,4828,5142,5437,5448,5668,5706,5725,6300,6335]))
